import request from '@/api/utils/request';

// 班级列表
export const getClass = data =>
  request({
    method: 'post',
    url: '/schClassInfo/listClassDormitoryInfo',
    data: data
  });

// 一键分配宿舍
export const automaticAssign = data =>
  request({
    method: 'post',
    url: '/schClassInfo/automaticAssignDormitory',
    data
  });

// 精准分配
export const exactAssign = data =>
  request({
    method: 'post',
    url: '/schClassInfo/exactAssignDormitory',
    data
  });

// 班级批量退宿
export const batchCheckout = data =>
  request({
    method: 'post',
    url: '/schClassInfo/dormitoryBatchCheckout',
    data
  });

// 查询班级学生住宿详情
export const classStudentDetails = id =>
  request({
    method: 'get',
    url: '/schClassInfo/classStudentDetails/' + id
  });

// 根据id查询
export const getInfo = id =>
  request({
    method: 'get',
    url: '/schClassInfo/get/' + id
  });

// 宿舍分配 /classInfo/distributionDeta 页面 获取班级列表
export const getClassInfo = data =>
  request({
    method: 'post',
    url: '/schClassInfo/unAllocationClassTree',
    data
  });
/**
 * 根据性别获取宿舍楼信息
 * @param {genderAttribute : 0/1} 0 女生 1男生
 */
export const getDormitorySexList = data =>
  request({
    method: 'get',
    url: '/schDormitory/getDormitorySexList',
    params: { genderAttribute: data }
  });
/**
 * 根据宿舍楼id和楼层查询房间
 */
export const getDormitoryRoom = (dormitoryId, storey, gender) =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getDormitoryRoomList',
    params: { dormitoryId, storey, gender }
  });
/**
 * 搜索房间列表
 */
export const getDormitoryRoomaNameList = data =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getDormitoryRoomaNameList',
    params: data
  });
// 一键分配宿舍
export const automaticAssignDormitory = data =>
  request({
    method: 'post',
    url: '/schClassInfo/automaticAssignDormitory',
    data
  });
// 根据班级获取未分配学生id
export const getUnAllocationClassStudentId = id =>
  request({
    method: 'get',
    url: '/schClassInfo/getUnAllocationClassStudent/' + id
  });
// 根据班级获取未分配学生id xin
export const getStudentDistributionList = data =>
  request({
    method: 'post',
    url: 'schClassInfo/getStudentDistributionList',
    data
  });
// 精确分配
export const exactAssignDormitory = data =>
  request({
    method: 'post',
    url: '/schClassInfo/exactAssignDormitory',
    data
  });
// 导出指定班级的Excel住宿信息
export const classExport = data =>
  request({
    method: 'post',
    url: '/schClassInfo/export',
    data,
    responseType: 'blob'
  });
// 获取房间中全部的床位和学生信息
export const getRoomDetails = id =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getRoomDetails/' + id
  });
// 获取床位信息
export const getRoomBedInfo = data =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getRoomBedInfo',
    params: data
  });

/**
 * 根据多个房间id查询房间床位信息
 * @ 数组[]
 */
export const roomBedList = data =>
  request({
    method: 'post',
    url: '/schDormitoryRoom/getRoomBedList',
    data
  });
